# 连接池模式  redis测试
import time

import redis

pool = redis.ConnectionPool(host="127.0.0.1", port=6379, db=9)
r = redis.Redis(connection_pool=pool)

while True:
    try:
        r.set('fool', 'Bar123')
        print(r.get('fool'))
        time.sleep(2)
    except Exception as e:
        print(e)
        time.sleep(2)
